package rocksea.com.wechat

import okhttp3.Interceptor
import okhttp3.Response

/**
 * Created by Mrw on 2018/2/4.
 *
 */
class RequestInterceptor:Interceptor
{
    override fun intercept(chain: Interceptor.Chain?): Response
    {
        val original = chain.let { it!!.request()}
        val originalHttpUrl = original.url()
        val url = originalHttpUrl.newBuilder()
                .addQueryParameter("api_key", null)
                .build()
        val request = original.newBuilder().url(url).build()
        return chain.let { it!!.proceed(request) }
    }
}